<template>
	<view>
		<view class="search_school">
			<u-search placeholder="请输入学校名称" v-model="schoolName" borderColor="#fff" height="50" 
			@search="loadData" @custom="loadData"></u-search>
		</view>
		<view class="school-title">
			<text>(指标不合格数目/待审核数目)</text>
		</view>
		<view class="">
			<u-list @scrolltolower="scrolltolower">

				<u-list-item v-for="(item, index) in indexList" :key="index" class="school-item">
					<u-cell :title="item.content" @click="viewRecords(item)">
					</u-cell>
				</u-list-item>
			</u-list>
		</view>
	</view>
</template>

<script>
	import {
		getImprovedSchools
	} from "@/api/supervise/work.js"
	export default {
		data() {
			return {
				schoolName: "",
				indexList: [],
			}
		},
		onLoad() {
			
			this.loadData();
			
		},
		methods: {
			viewRecords(item) {
				uni.setStorageSync("schoolId",item.schoolId);
				uni.setStorageSync("schoolName",item.schoolName);
				this.$tab.navigateTo("/pages/work/schoolFeedback/detail/school-rectify");
				
			},
			// 学段类型
			change() {
				
				this.loadData()
				
			},
			scrolltolower() {},
			loadData(){
				
				this.indexList = [];
				
				let activityId = uni.getStorageSync("activityId")
				let areaId = uni.getStorageSync("areaId")
				let schoolName = this.schoolName
				
				getImprovedSchools(activityId,areaId,schoolName).then(res=>{
					
					let schools = res.schools;
					
					for(let i=0;i<schools.length;i++){
						this.indexList.push({
							content:schools[i].name+"("+schools[i].countImprove+"/"+schools[i].countActivity+")",
							schoolId:schools[i].schoolId,
							schoolName:schools[i].name
						})
					}
					
				})
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.school-title {
		text-align: center;
		height: 6vh;
		line-height: 6vh;
		background-color: #fff;
	}

	.search_school {
		padding: 10px 10px;
	}

	.state-type {
		height: 8vh;
		line-height: 8vh;
	}

	.mode-type {
		height: 8vh;
		line-height: 8vh;
	}

	.school-item {
		text-align: center;
	}
</style>